package cn.com.pkas.xml
{
	import flash.events.Event;
	import flash.external.ExternalInterface;
	import flash.net.URLLoader;
	import flash.net.URLRequest;
	
	import mx.controls.Alert;
	
	public class XMLLoader
	{
		public function XMLLoader()
		{
		}
		private var xml:XML = null;
		
		public function getXml():XML{
			
			var loader:URLLoader = new URLLoader();
		    loader.addEventListener(Event.COMPLETE,completeHandler);
		    loader.load(new URLRequest(getUrl() + "view/common/resource.xml"));
//		    Alert.show("123");
			return xml;
		}
		
		private function getUrl():String{  
            var url:String = ExternalInterface.call("function getUrl(){return document.location.href;}");  
			return url;  
	    }  

		public function completeHandler(e:Event):void{
			xml = XML(e.target.data);
		}

	}
}